from .models import *
from rest_framework import serializers
from rest_framework.validators import UniqueValidator

class DepartSerializer(serializers.ModelSerializer):

    class Meta:
        model = Depart
        fields = '__all__'

    def get_fields(self):
        fields = super(DepartSerializer, self).get_fields()
        fields['children'] = DepartSerializer(many=True)
        return fields